<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="portal" uri="/WEB-INF/portal.tld" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <%@ include file="/common/plateform/include/common-base.jsp"%>
  <title>${param.title}|模块设置</title>
  <!-- Tell the browser to be responsive to screen width -->
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
</head>

<!-- 以下是body主体内容的模块区域 -->
<body class="hold-transition ${sysColor} sidebar-mini">
<div class="wrapper">

  <!-- top start -->
  <%@include file="/common/plateform/top.jsp" %>
  <!-- top end -->
  <!-- left start -->
  <%@include file="/common/plateform/left.jsp" %>
  <!-- left end-->

  <div class="content-wrapper">
    <!-- Main start -->
	<section class="content">
      <div class="row">
        <div class="col-xs-12">
        
          <!------搜索  start ------->
          <form id="searchForm" class="form-horizontal">
				<input type="hidden" name="pageName" value="sysPageManager-list">
				<input type="hidden" name="formName" value="searchForm">
				<input type="hidden" name="sysPageManager.w_pageId" value="${param.moduleId}">
			</form>
			
		<form id="searchForm2" class="form-horizontal">
			<input type="hidden" name="pageName" value="sysPageDetail-list">
			<input type="hidden" name="formName" value="searchForm">
			<input type="hidden" name="orderBy" value="sysPageDetail.tab_no">
			<input type="hidden" name="sysPageDetail.w_moduleId" value="${param.moduleId}">
			<input type="hidden" name="sysPageDetail.templateId" value="${param.templateId}"/>
	  	</form>
	     <!------- 搜索 end -------->
           
        <!------- 列表 start -------->
          <div class="col-xs-12">
          	<div class="box">
          	  <div class="box-header with-border">
                 <h4><i class="fa fa-cog"></i> 设置【${param.title}】基本属性
                 <span style="font-size:14px;margin-left:20px;">
	                	<i class="fa fa-info-circle fx8"></i> 
	                	当前使用模板是
	                	[<span class="fx7" data-name="sysPageManager.templateUrl"></span><span class="fx7" data-name="sysPageManager.templateName">${param.templateName}</span>]
	                	 [<span class="fx12" data-name="sysPageManager.templateDesc">万能模板</span>]
				</span>
				<button aria-label="Left Align" class="btn btn-warning" type="button" onclick="popWindow();"><i class="fa fa-search"></i> 选择模板</button>
						                  
              </h4>
	          <form class="form-horizontal" role="form" id="pageForm">
							<input type="hidden" id="addForm_formToken" name="formToken" >
							<input type="hidden" name="pageName"  value="sysPageManager-list">
							<input type="hidden" name="formName"  value="addForm">
							
							<input type="hidden" name="sysPageManager.templateId" data-name="sysPageManager.templateId" value="">
							<input type="hidden" name="sysPageManager.templateName" data-name="sysPageManager.templateName"  value="">
							<input type="hidden" name="sysPageManager.templateUrl" data-name="sysPageManager.templateUrl"   value="">
							<input type="hidden" name="sysPageManager.templateDesc" data-name="sysPageManager.templateDesc" value="">
							
							<input type="hidden" name="sysPageManager.w_pageId"  value="${param.moduleId}">
							<input type="hidden" name="sysPageManager.sysName" value="${param.sysName}"/>
						    <input type="hidden" name="sysPageManager.menuId" value="${param.menuId}"/>
						    <input type="hidden" name="sysPageManager.projectName" value="${param.sysName}"/>
						    <input type="hidden" name="sysPageManager.titleName" value="${param.title}"/>
						    <!-- sysPageManager的主键和sysModule的主键保持一致 -->
						    <input type="hidden" name="sysPageManager.pageId" value="${param.moduleId}"/>
						    
					        <div class="box-body" id="addForm_submitFormData">
					          <!-- Custom Tabs -->
					          <div class="nav-tabs-custom">
					            <div class="tab-content">
					              <div class="tab-pane active">

									<div class="form-group">
						                  <label class="col-sm-2 control-label" >生成目录</label>
						                  <div class="col-sm-4">
						                	<input type="text" data-name="sysPageManager.codeUrl" name="sysPageManager.codeUrl" class="form-control clean" value="${param.pageUrl}" required placeholder="如：plateform/admin/sale" />
						                  </div>
						                  <label class="col-sm-2 control-label" >生成页面名</label>
						                  <div class="col-sm-4">
						                	<input type="text" data-name="sysPageManager.pageName" name="sysPageManager.pageName" class="form-control clean" value="${param.menuId}.jsp" required placeholder="必填项" />
						                  </div>
							        </div>
							        
									<div class="form-group">
						                  <label class="col-sm-2 control-label" >主表主对象</label>
						                  <div class="col-sm-4">
						                	<input type="text" data-name="sysPageManager.mainObj" name="sysPageManager.mainObj" class="form-control clean" required placeholder="如：trpPro" />
						                  </div>
						                  <label class="col-sm-2 control-label" >主表主键属性</label>
						                  <div class="col-sm-4">
						                	<input type="text" data-name="sysPageManager.mainId" name="sysPageManager.mainId" class="form-control clean" required placeholder="如：proId" />
						                  </div>
							        </div>
							         <div class="form-group">
							         	<span style="font-size:12px;margin-left:80px;">
	                					<i class="fa fa-info-circle fx7"></i>
							         	以下设置结果和IUS参数配置相关联，请根据实际情况进行分析。</span>
							         </div>
							        <div class="form-group">
						                  <label class="col-sm-2 control-label" >接口标识</label>
						                  <div class="col-sm-4">
						                  	<div class="input-group">
						                		<input type="text" id="sysPageManager_portName" data-name="sysPageManager.portName" name="sysPageManager.portName" class="form-control clean fx7"  value="${param.menuId}" placeholder="如：test-com-fun" />
						                		<div class="input-group-addon">如：test-com-fun</div>
						                	</div>
						                  </div>
						                  <label class="col-sm-2 control-label" >是否多对象</label>
						                  <div class="col-sm-4">
						                  	<div class="input-group">
						                		<input type="text" id="ifSingle-input" data-name="sysPageManager.ifSingle" name="sysPageManager.ifSingle" class="form-control clean fx7" required placeholder="如：T或者F" />
						                		<div class="input-group-addon">只能填写T/F</div>
						                	</div>
						                  </div>
							        </div>
							        <div class="form-group">
						                  <label class="col-sm-2 control-label" >搜索表单</label>
						                  <div class="col-sm-4">
										    <div class="input-group">
						                		<input type="text" data-name="sysPageManager.formSearch" id="sysPageManager_formSearch" readonly="readonly" name="sysPageManager.formSearch" class="form-control clean fx7" required placeholder="如：searchFormMain-1" />
										      	<div class="input-group-addon"><button class="btn btn-info btn-xs" onclick="toOpenIus('sysPageManager_formSearch');" type="button"><i class="fa fa-search"></i> 选择参数</button></div>
										    </div>
						                  </div>
						                  
    
						                  <label class="col-sm-2 control-label" >删除表单</label>
						                  <div class="col-sm-4">
						                  	 <div class="input-group">
						                		<input type="text" data-name="sysPageManager.formDel" name="sysPageManager.formDel" readonly="readonly" id="sysPageManager_formDel" class="form-control clean fx7" required placeholder="如：delFormMain" />
										      	<div class="input-group-addon"><button class="btn btn-info btn-xs" onclick="toOpenIus('sysPageManager_formDel');" type="button"><i class="fa fa-search"></i> 选择参数</button></div>
										    </div>
						                  </div>
							        </div>
							        

					              </div>					             
					              <!-- /.tab-pane -->
					            </div>
					            <!-- /.tab-content -->
					          </div>
					          <!-- nav-tabs-custom -->
				                <button  onclick="toTemplateDetailAdd();" class="btn btn-success" type="button"><i class="fa fa-plus-circle"></i> 增加子标签 </button>
				                
				                <button type="button" class="btn btn-danger pull-right" onclick="edit('pageForm');"><i class="fa fa-plus-circle"></i> 设置完成</button> 
				            </div>
						</form>
           </div>
         </div>
         
         
         <div id="dataList-body-detail">
      
     	</div>
     	
     	<div class="box">
	     	<div class="form-group col-sm-12 text-center">
				<button type="button" class="btn btn-danger btn-lg" onclick="createProject('${param.moduleId}')">
				<i class="fa fa-flag-o"></i> 保存设置完成，开始生成页面 
				</button>
	        </div>
	    </div>
           
        </div>
      </div>
    </section>
    <!-- Main end -->
  </div>
  <!-- /.content-wrapper -->
  <!-- foot start -->
  <%@include file="/common/plateform/foot.jsp" %>
  <!-- foot start -->

  <div win-title="添加tab标签" class="modal fade" id="my_modal_sysPageDetail_add" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
							×
						</button>
						<h4 class="modal-title">
							<font color="red">tab子标签添加</font> 
						</h4>
					</div>
					<div class="modal-body">
						<form class="form-horizontal" role="form" id="addPageDetailForm">
							<input type="hidden" name="pageName"  value="sysPageDetail-list"/>
							<input type="hidden" name="formName"  value="addForm"/>
							<input type="hidden" name="sysPageDetail.templateId" value="${param.templateId}"/>
							<input type="hidden" name="sysPageDetail.templateName" value=""/>
							<input type="hidden" name="sysPageDetail.templateUrl" value=""/>
							<input type="hidden" name="sysPageDetail.delStatus" value="F"/>
							<input type="hidden" name="sysPageDetail.moduleId" value="${param.moduleId}"/>
							<input type="hidden" id="formToken" name="formToken" />
					        <div class="box-body" id="submitFormData">
					          <!-- Custom Tabs -->
					          <div class="nav-tabs-custom">
					            <div class="tab-content">
					              <div class="tab-pane active" id="tab_1">
					              
					                <div class="form-group">
						                  <label class="col-sm-3 control-label" >标签编号</label>
						                  <div class="col-sm-8">
						                		<input type="text" name="sysPageDetail.tabNo" class="form-control clean" required placeholder="必填项,数字" />
						                  </div>
						             </div>
							        
							        <div class="form-group">
						                  <label class="col-sm-3 control-label" >标签名称</label>
						                  <div class="col-sm-8">
						                		<input type="text" name="sysPageDetail.tabName" class="form-control clean" required placeholder="必填项，中文名称" />
						                  </div>
							        </div>
							        
							        <div class="form-group">
						                  <label class="col-sm-3 control-label" >每行栅格</label>
						                  <div class="col-sm-8">
						                		<input type="text" name="sysPageDetail.colNum" class="form-control" required placeholder="如：数字5或10" value="10"/>
						                </div>
							        </div>
							        
					              </div>					             
					              <!-- /.tab-pane -->
					            </div>
					            <!-- /.tab-content -->
					          </div>
					          <!-- nav-tabs-custom -->
					        </div>
			                <div class="box-footer">
				                <button type="button" class="btn btn-success pull-left" onclick="cannel('sysPageDetail_add');">取消</button>
				                <button type="button" class="btn btn-danger pull-right" onclick="addPageDetail('addPageDetailForm');">提交保存</button>
				            </div>
						</form>
					</div>
				</div>
				<!-- /.modal-content -->
			</div>		
</div>  


<div win-title="数据表对象选择窗口" class="modal fade" id="my_modal_tablebox" tabindex="-2" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog" style="margin-top:20px; width: 1200px;">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
							×
						</button>
						<h4 class="modal-title">
							<font color="red">数据表对象选择器</font> 
						</h4>
					</div>
					<div class="modal-body">
							<form id="sortSearchForm" class="form-horizontal">
								<input type="hidden" name="doCode" value="dymicSql"/>
								<input type="hidden" name="modelTypes" value="s_sortInfo"/>
								<input type="hidden" name="sortInfo.w_sortStatus" value="1"/>
								<input type="hidden" name="orderBy" value="obj_name"/>
								<div class="form-group">
									<div class="col-sm-2 text_r"><label class="control-label" >中文名：</label></div>
									<div class="col-sm-2">
										 <input type="text" class="form-control clean"  name="sortInfo.wl_sortName" value=""/>
									</div>
									<div class="col-sm-2 text_r"><label class="control-label" >表英文名：</label></div>
									<div class="col-sm-2">
										 <input type="text" class="form-control clean"  name="sortInfo.wl_infoTableName" value=""/>
									</div>
									<div class="col-sm-2">
										<button class="btn btn-success" type="button" onclick="getTabelsDataList();"><i class="fa fa-search"></i> 搜索</button>&nbsp;&nbsp;
										<button class="btn btn-warning" type="button" onclick="mytools.cleanData('#sortSearchForm');"><i class="fa fa-close"></i> 清空</button>
									</div>
								</div>
							</form>
					        <div class="box-body">
					          <!-- Custom Tabs -->
					            <div class="tab-content form-group" id="tablebox_content">
					              
					              <!-- /.tab-pane -->
					            </div>
					            <!-- /.tab-content -->
					          <!-- nav-tabs-custom -->
					        </div>
			                <div class="box-footer">
			                	<button type="button" class="btn btn-danger  pull-left" onclick="checkObjNameStr();">选择完成</button>
				                <button type="button" class="btn btn-success pull-right" onclick="cannel('tablebox');">关闭</button>
				            </div>
					</div>
				</div>
				<!-- /.modal-content -->
			</div>		
</div>

<div win-title="字段选择窗口" class="modal fade" id="my_modal_colum_checkbox" tabindex="-2" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog" style="margin-top:10px; width:900px;">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
							×
						</button>
						<h4 class="modal-title">
							<font color="red">字段选择器[<span id="columbox_table_name"></span>表]</font> 
						</h4>
					</div>
					<div class="modal-body">
						<form class="form-horizontal" role="form" >
					        <div class="box-body">
					           
					            <div class="tab-content form-group" id="tabs_checkbox_content">
					               
					            </div>
					           
					        </div>
			                <div class="box-footer">
				                <button type="button" class="btn btn-danger  pull-left" onclick="checkObjColumStr();">选择完成</button>
				                <span class="pull-left">&nbsp;<input type="checkbox" id="all-checks" onclick="xzcolumall(this)"/>全部选中</span>
				                <button type="button" class="btn btn-success pull-right" onclick="cannel('colum_checkbox');">关闭</button>
				            </div>
						</form>
					</div>
				</div>
				<!-- /.modal-content -->
			</div>		
</div>

<div win-title="模板选择窗口" class="modal fade" id="template_modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
						<div class="modal-dialog" style="width: 900px;">
									<div class="modal-content">
										<div class="modal-header">
											<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
												&times;
											</button>
											<h4 class="modal-title">
												<font color="red">模板列表</font>&nbsp;
											</h4>
										</div>
										<div class="modal-body">
											<form class="form-horizontal" role="form" id="templateForm">
											<input type="hidden" name="pageName" value="sysTemplate-list"/>
											<input type="hidden" name="formName" value="searchForm"/>
											模板名称：<input type="text" class="form-control" style="height: 30px; display: inline; width: 25%;"  name="sysTemplate.wl_templateName" value="" />
											<button type="button" class="btn btn-primary" onclick="getTemplateList();">查询</button>
											<button  type="button" class="btn btn-primary" onclick="FormUtil.cleanData('templateForm');">重置 </button>
											               <table id="templateTable" class="table table-bordered table-hover" >
												                <thead>
												                <tr>
												                  <th>模板名称</th>
												                  <th>模板描述</th>
												                  <th>操作</th>
												                </tr>
												                </thead>
												                <tbody id="templateList">
												                </tbody>
											              </table>
											              <center>
											    	  		<ul id="pageList"></ul>
											              </center>
											</form>
										</div>
									</div>
							</div>	
</div>   

<div win-title="规则选择窗口" class="modal fade" id="my_modal_rules" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog" style="width:1000px;">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
							×
						</button>
						<h4 class="modal-title">
							<font color="red">选择规则</font> 
						</h4>
					</div>
					<div class="modal-body">
						<form class="form-horizontal" role="form" id="sysRulesTemplate-searchForm">
							<input type="hidden" name="doCode" value="dymicSql"/>
							<input type="hidden" name="pageName" value="sysRulesTemplate-list"/>
							<input type="hidden" name="formName" value="searchForm"/>
							<input type="hidden" name="sysRulesTemplate.w_delStatus" value="F"/>
							<input type="hidden" name="orderBy" value="sysRulesTemplate.rules_no"/>
							<div class="form-group">
								<div class="col-sm-2 text_r"><label class="control-label" >公式名称：</label></div>
								<div class="col-sm-2">
							 		<input type="text" class="form-control clean"  name="sysRulesTemplate.wl_formulaName" value="" id="formulaName"/>
								</div>
						   		<div class="col-sm-2 text_r"><label class="control-label" >规则编号：</label></div>
								<div class="col-sm-2">
							 		<input type="text" class="form-control clean"  name="sysRulesTemplate.wl_rulesNo" value="" id="rulesNo"/>
								</div>
								<div class="col-sm-4">
									<button type="button" class="btn btn-success" onclick="getSysRulesData();">查询</button>
									<button type="button" class="btn btn-warning" onclick="FormUtil.cleanData('sysRulesTemplate-searchForm');">重置 </button>
								</div>
							</div>
							
							</form>
			            <table class="table table-bordered table-hover" >
				                <thead class="bg-success">
				                <tr>
						                <th>规则类型	</th>
										<th>排序/规则编号/规则名称/公式名称/公式类型</th>
				                        <th>可输入/参数单位/验证/填写提示/操作</th>
				                </tr>
				                </thead>
				                <tbody id="sysRulesTemplate-body">
				                </tbody>
			              </table>
			              <center>
			    	  		<ul id="sysRulesTemplate-page"></ul>
			              </center>
					</div>
				</div>
				<!-- /.modal-content -->
			</div>		
</div>

</body>


<!-- 以下是template列表模板的模块区域 -->
<script type="text/template" id="dataList-template-detail">
		<? for ( var i = 0; i < rows.length; i++) {?>
		<?if(rows.length>1){?>
			<?if(i==rows.length-1 && ((i-1)%2!=0)){?>
				<div class="col-xs-12">
			<?}else{?>
				<div class="col-xs-6">
			<?}?>
		<?}else{?>
			<div class="col-xs-12">
		<?}?>
		<form id="submitDetailForm_<?=i?>" class="form-horizontal">
          <div class="box box-success box-body">
			<input type="hidden" name="doCode" value="dymicSql"/>
			<input type="hidden" name="modelTypes" value="u_sysPageDetail">
			<input type="hidden" name="sysPageDetail.w_pageDetailId" value="<?=rows[i].pageDetailId?>" />
			<input type="hidden" name="sysPageDetail.templateName" data-name="sysPageManager.templateName" value="<?=strUtil.doNull(rows[i].templateName,'')?>">
			<input type="hidden" name="sysPageDetail.projectName" data-name="sysPageManager.projectName" value="<?=strUtil.doNull(rows[i].projectName,'')?>">
			<input type="hidden" name="sysPageDetail.pageName" data-name="sysPageManager.pageName" value="<?=strUtil.doNull(rows[i].pageName,'')?>">
			<input type="hidden" name="sysPageDetail.codeUrl" data-name="sysPageManager.codeUrl" value="<?=strUtil.doNull(rows[i].codeUrl,'')?>">
			<input type="hidden" name="sysPageDetail.sysName" data-name="sysPageManager.sysName" value="<?=strUtil.doNull(rows[i].sysName,'')?>">
			<input type="hidden" name="sysPageDetail.cateNo" data-name="sysPageManager.cateNo" value="<?=strUtil.doNull(rows[i].cateNo,'')?>">
	          <div class="box-header with-border">
                 <h4>
					<i class="fa fa-cog fx8"></i> 设置TAB<?=rows[i].tabNo?>标签属性
					<i class="pull-right fa fa-close fx8 f16" onclick="delTmpDetail('<?=rows[i].pageDetailId?>','tab<?=(i+1)?>-<?=rows[i].tabName?>')" style="cursor:pointer;" title="删除"></i>
				</h4>
              </div>
              <div class="box-body form-horizontal">
              
	                <div class="form-group" style="display:none;">
	                  <span class="col-sm-1 control-label" ></span>
	                  <div class="col-sm-8">
							<i class="fa fa-info-circle fx8"></i> 说明：tab标签[<?=rows[i].tabNo?>]定义了[<?=rows[i].colNum?>]个栅格列
	                  </div>
	                </div>
					
					<div class="form-group">
	                  <label class="col-sm-3 control-label" >栅格列数</label>
	                  <div class="col-sm-6">
						<input type="text" value="<?=rows[i].colNum ?>" name="sysPageDetail.colNum" class="form-control" placeholder="推荐选用5或10"/>
	                  </div>
	                </div>
	                <div class="form-group">
	                  <label class="col-sm-3 control-label" >标签名称</label>
	                  <div class="col-sm-6">
						<input type="text" value="<?=rows[i].tabName ?>" name="sysPageDetail.tabName" class="form-control"/>
	                  </div>
	                </div>
					<div class="form-group">
						<label class="col-sm-3 control-label" >关联对象</label>
						<div class="col-sm-6">
							<input type="text" id="input_objName_<?=i?>"  value="<?=strUtil.doNull(rows[i].objName,'')?>" readonly="readonly" name="sysPageDetail.objName" class="form-control"/>
					    </div>
						<div class="col-sm-3">
							<button type="button" class="btn btn-danger" onclick="addTabObj('input_objName_<?=i?>','submitDetailForm_<?=i?>');"> <i class="fa fa-plus-circle"></i> 添加对象</button>
						</div>
					</div>

					<div class="form-group">
		                  <label class="col-sm-3 control-label" >表单内容</label>
		                  <div class="col-sm-9">
							<?if(!strUtil.isNull(rows[i].objName)){?>
								<? var objs = rows[i].objName.split(",")?>
								<?for(var j =0;j<objs.length;j++){ ?>
									<?var objName = objs[j]?>
		                  			<button type="button" style="margin-top:5px;" class="btn btn-success btn-sm objcolum<?=i?>" colum=""  onclick="addTabObjColum(this,'tabContent_<?=i?>','<?=objName?>');"><i class="fa fa-plus-circle"></i> <?=objName?>属性设置</button>&nbsp;
								<?}?>
							<?}?>
		                  </div>
			        </div>
					<div class="form-group">
						 <label class="col-sm-3 control-label" >addForm</label>
						 <div class="col-sm-6">
						  	<input type="text" name="sysPageDetail.formAdd" readonly="readonly" id="sysPageDetail_formAdd_<?=i?>" class="form-control" value="<?=strUtil.doNull(rows[i].formAdd,'addFormTab'+rows[i].tabNo)?>"/>
							<div class="input-group">
								<button class="btn btn-primary btn-xs" onclick="toOpenIus('sysPageDetail_formAdd_<?=i?>');" type="button"><i class="fa fa-search"></i> 参数选择</button>&nbsp;&nbsp;
								<button class="btn btn-danger btn-xs"  onclick="toAddSysRulesData('sysPageDetail_formAdd_<?=pageDetailId?>')" type="button"><i class="fa fa-wrench"></i> 规则设置</button>
							</div>
						 </div>
					</div>
					<div class="form-group">
						 <label class="col-sm-3 control-label" >editForm</label>
						 <div class="col-sm-6">
						  		<input type="text" name="sysPageDetail.formEdit" readonly="readonly" id="sysPageDetail_formEdit_<?=i?>" class="form-control" value="<?=strUtil.doNull(rows[i].formEdit,'editFormTab'+rows[i].tabNo)?>"/>
							<div class="input-group">
								<button class="btn btn-primary btn-xs" onclick="toOpenIus('sysPageDetail_formEdit_<?=i?>');" type="button"><i class="fa fa-search"></i> 参数选择</button>&nbsp;&nbsp;
								<button class="btn btn-danger btn-xs" onclick="toAddSysRulesData('sysPageDetail_formEdit_<?=pageDetailId?>')" type="button"><i class="fa fa-wrench"></i> 规则设置</button>
							</div>
						 </div>
					</div>
					<div class="form-group" style="display:none;">
						 <label class="col-sm-3 control-label" >searchForm</label>
						 <div class="col-sm-6">
						  	<input type="text" name="sysPageDetail.formSearch" class="form-control" value="<?=strUtil.doNull(rows[i].formSearch,'searchFormTab'+rows[i].tabNo)?>"/>
						 </div>
					</div>
					<div class="form-group" style="display:none;">
						 <label class="col-sm-3 control-label" >delForm</label>
						 <div class="col-sm-6">
						  	<input type="text" name="sysPageDetail.formDel" class="form-control" value="<?=strUtil.doNull(rows[i].formDel,'delFormTab'+rows[i].tabNo)?>"/>
						 </div>
					</div>
	                
					<div class="form-group col-sm-12" style="display:none;">
						<textarea rows="4" cols="20"  id="tabContent_<?=i?>" name="sysPageDetail.tabContent"  class="form-control"><?=strUtil.doNull(rows[i].tabContent,'')?></textarea>
			        </div>

					<div class="form-group col-sm-12 text-center">
						<button type="button" class="btn btn-warning btn-lg" onclick="submitDetail('submitDetailForm_<?=i?>','<?=rows[i].tabName?>	','tabContent_<?=i?>','objcolum<?=i?>');"><i class="fa fa-cog"></i> 保存设置 </button>
	                </div>
				
		        </div>
            </div>
        </div>
	</form>
   <?}?>  		
</script>


<script type="text/template" id="templateDataList">
	  		<? for ( var i = 0; i < rows.length; i++) {?>
				<tr>
					<td style="display:none;"><?=rows[i].templateId?></td>
					<td>
						<?=strUtil.doNull(rows[i].templateName,'-')?>
					</td>
					<td>
						<?=strUtil.doNull(rows[i].templateDesc,'-')?>
					</td>
					<td>
					   <button type="button" class="btn btn-warning btn-xs" onclick="setSelect('<?=rows[i].templateId?>','<?=rows[i].templateName?>','<?=rows[i].templateUrl?>','<?=rows[i].templateDesc?>')">选中</button>
					</td>
				</tr>
     		<?}?>
</script>
<script type="text/template" id="sysRulesTemplate-template">
		<? for ( var i = 0; i < rows.length; i++) {?>
		<tr>
			<td><?=(i+1)?>.<?=strUtil.doNull(rows[i].rulesType,'')?></td>
			<td>
			<div class="form-group"><?=rows[i].orderNo+'-'+rows[i].rulesNo?>
			 | <?=strUtil.doNull(rows[i].rulesName,'')?>
			 | <?=strUtil.doNull(rows[i].formulaName,'')?>
			 | <?=rows[i].dealType?>
			</div>
			<div class="form-group fx9"><i class="fa fa-info-circle"></i> <?=strUtil.doNull(rows[i].formulaDesc,'')?></div>
			<div class="form-group fx5"><?=strUtil.doNull(rows[i].formulaCal,'')?></div>
			</td>
			<td>
				<form id="addFormRule_<?=rows[i].rulesId?>">
					<input type="hidden" name="doCode" value="dymicSql"/>
					<input type="hidden" name="modelTypes" value="i_trpRulesParam"/>
					<input type="hidden" name="trpRulesParam.cateId" value="${param.cateId}"/>
					<input type="hidden" name="trpRulesParam.cateNo" value="${param.cateNo}"/>
					<input type="hidden" name="trpRulesParam.cateName" value="${param.cateName}"/>
					<input type="hidden" name="trpRulesParam.formulaCal" value="<?=rows[i].formulaCal ?>"/>
					<input type="hidden" name="trpRulesParam.formulaSrc" value="<?=rows[i].formulaCal ?>"/>
					<input type="hidden" name="trpRulesParam.formulaDesc" value="<?=rows[i].formulaDesc ?>"/>
					<input type="hidden" name="trpRulesParam.formulaName" value="<?=rows[i].formulaName?>"/>
					<input type="hidden" name="trpRulesParam.paramName" value="<?=rows[i].formulaName?>"/>
					<input type="hidden" name="trpRulesParam.formulaNo" value="<?=rows[i].formulaNo?>"/>
					<input type="hidden" name="trpRulesParam.rulesId" value="<?=rows[i].rulesId?>"/>
					<input type="hidden" name="trpRulesParam.rulesNo" value="<?=rows[i].rulesNo?>"/>
					<input type="hidden" name="trpRulesParam.rulesName" value="<?=rows[i].rulesName?>"/>							
					<input type="hidden" name="trpRulesParam.rulesType" value="<?=rows[i].rulesType?>"/>							
					<input type="hidden" name="trpRulesParam.dealType" value="<?=rows[i].dealType?>"/>							
					<input type="hidden" name="trpRulesParam.constantType" value="<?=rows[i].nodeType?>"/>							
					<input type="hidden" name="trpRulesParam.constantStatus" value="<?=rows[i].nodeStatus?>"/>	
					<input type="hidden" name="trpRulesParam.orderNo" value="<?=rows[i].orderNo?>"/>	

					
					<div class="form-group">
						<input type="radio" name="trpRulesParam.showFlag" value="T" checked/> 是 
						<input type="radio" name="trpRulesParam.showFlag" value="F" />	否 
						&nbsp;
						<select name="trpRulesParam.paramUnit">
					 		<option value="">--单位--</option>
					 		<option value="%">%</option>
							<option value="天">天</option>
						</select>&nbsp;&nbsp;
						<select name="trpRulesParam.showValid">
					 		<option value="">--选择输入验证--</option>
					 		<option value="^(100|[1-9]\d|\d)$">0-100的整数</option>
							<option value="^\+?[1-9]\d*$">大于0的整数</option>
							<option value="^\+?[0-9]\d*$">大于或等于0的整数</option>
							<option value="^(([1-9]+)|([0-9]+\.[0-9]{1,2}))$">大于0的保留两位小数</option>
							<option value="^([1]?[0-9]|2[0-3]):[0-5][0-9]-([1]?[0-9]|2[0-3]):[0-5][0-9]$">时间9:00-11:00</option>
						</select>
					</div>
					<div class="form-group">
						<div class="col-sm-8">
							输入提示：<input type="text" class="form-control"  name="trpRulesParam.showTip"/>
						</div>
						<div class="col-sm-5" style="display:none;">
							缺省：<input type="text" class="form-control"  name="trpRulesParam.paramNo"/>
						</div>
					</div>
					<div class="form-group pull-right">
						<button type="button" class="btn btn-danger btn-sm" onclick="addRulesItem('addFormRule_<?=rows[i].rulesId?>','${param.cateNo}','<?=rows[i].rulesNo?>','<?=rows[i].formulaCal?>');">选中</button>
					</div>
				</form> 
			</td>
		</tr>
   <?}?>  		
</script>
</html>

<!-- 以下是js模块区域 -->
<script>
var clickMenu = "template-list-instance";
var id,myPage,dataListId,searchFormId,isShowLog,tableSort,tableId;
myPage = 10;
dataListId = "dataList";
searchFormId = "searchForm";
tableSort = "sysTemplate";
tableId = "templateId";
isShowLog = true;

$(function () {
	//1、加载分页列表数据
	//getTemplateInfo();
	getTableDataDetail();
	//2、控制是否启用token
	//setToken();
	
	//请在下面补充其他初始化方法（如数据字典、页面加载数据等）
	//3、初始化数据字典
	//DictUtil.getCommonDictData("select","#addForm_cateId","sysPageManager.cateId","doCode=dymicSql&modelTypes=s_trpCate","{value:'cateId',text:'cateName',other:'cateNo,cateType'}","${param.cateId}");
 });
var dateObject = $('.datepicker').datepicker( {
	language : 'zh-CN',
	//inline: true,
	todayBtn : "linked",
	format : "yyyy-mm-dd",
	autoclose: true
});

function toDele(id){
	var index_submit = layer.confirm('您确定要删除信息吗？', {btn: ['Yes','No'],closeBtn: 0,offset: '220px'}
	, function(){
		layer.close(index_submit);
		var paramLoadData = {"pageName":"sysPageDetail-list","formName":"delForm","sysPageDetail.w_pageDetailId":id};
		doDele(paramLoadData);
	});
}
//反显数据
function showData(type,myData){
	console.log(myData);
	if("view"==type){
		FormUtil.loadView("sysTemplate", myData);
		$("#my_modal_view").modal("show");
	}else if("edit"==type){
		//修改弹框时，初始化数据字典
		cleanData('editForm_submitFormData');
		//DictUtil.getCommonDictData("select","#editForm_cateId","sysPageManager.cateId","doCode=dymicSql&modelTypes=s_trpCate","{value:'cateId',text:'cateName',other:'cateNo,cateType'}",myData.cateId);
		FormUtil.loadView("sysTemplate", myData);
		//FormUtil.fillData("#editForm", myData,"id");
		$("#w_"+tableId).val(myData.templateId);
		$("#my_modal_edit").modal("show");
	}
}


//加载数据
function getTemplateInfo(){
	$.ajax({
		   type:'get',
		   url:common_info_url,
		   data:$("#"+searchFormId).serialize(),
		   dataType:'json',
		   success: function(myData){
		   		FormUtil.loadView("sysPageManager", myData);
		   },
		   error: function(e) {
			   add('pageForm');//初始化sysPageManager表
		   } 
		});	
  }
function getTableDataDetail(){
	$.ajax({
		   type:'get',
		   url:common_list_url,
		   data:$("#searchForm2").serialize()+getCurrentPage(common_list_url+"?"+$("#searchForm2").serialize(),myPage),
		   dataType:'json',
		   success: function(myData){
		    console.log(myData);
			var data = baidu.template("dataList-template-detail",eval(myData));  
			$("#dataList-body-detail").html(data);
		   }
		});	
  }

//清空数据
function cleanData(id){
	$('#'+id).find(".clean").val("");//按照样式清空；
}

//获取对象值
function loadObj(type,paramData){
	$.ajax({
	    type:'get',
	   	url:common_info_url+"?doCode=dymicSql",
	    data: paramData,
	    async:false,
	    dataType:"json",
	    success: function(myData){
	    	showData(type,myData);
	  	}
	});	
}

//删除信息（逻辑删除）
function doDele(paramData){
	$.ajax({
	    type:"post",
	    url:common_submit_url+"?doCode=dymicSql",
	    data: paramData,
	    dataType:"json",
	    success: function(myData){
	    	var result = myData.flag;
	    	if(result=="T"){
	    		layer.alert("删除操作成功");
	    		refresh();
	    	}
	  	}
	});	
}

function toTemplateDetailAdd(){
	cleanData('submitFormData');//情况模态窗口内数据
	
	
	$("#addPageDetailForm").find("input[name='sysPageDetail.templateId']").val($("#pageForm").find("input[name='sysPageManager.templateId']").val());
	$("#addPageDetailForm").find("input[name='sysPageDetail.templateName']").val($("#pageForm").find("input[name='sysPageManager.templateName']").val());
	$("#addPageDetailForm").find("input[name='sysPageDetail.templateUrl']").val($("#pageForm").find("input[name='sysPageManager.templateUrl']").val());

	
	$('#my_modal_sysPageDetail_add').modal('show');
}

/**
 * 新增表单数据提交
 * @param formId
 */
function addPageDetail(formId){
	var index_submit = layer.confirm('您确定要提交信息吗？', {btn: ['Yes','No'],closeBtn: 0,offset: '220px'}
	, function(){
		layer.close(index_submit);
		$.ajax({
		    type:"post",
		    url:common_submit_url,
		    data:$("#"+formId).serialize(),
		    dataType:"json",
		    success: function(myData){
		    	//console.log(myData);
		    	if(myData.flag=="T"){
		    		layer.alert("数据保存成功");
		    		$("#my_modal_sysPageDetail_add").modal("hide");
		    	}else{
		    		layer.alert(myData.msg);
		    	}
		    	refresh();
		  	}
		});	
	});
}


function add(formId){
		$.ajax({
		    type:"post",
		    url:common_submit_url,
		    data:$("#"+formId).serialize(),
		    dataType:"json",
		    success: function(myData){
		    	if(myData.flag=="T"){
		    		//layer.alert("数据保存成功");
		    	}else{
		    		//layer.alert(myData.msg);
		    	}
		    	getTemplateInfo();
		  	}
		});	
}

/**
 * 修改表单数据提交
 * @param formId
 */
function edit(formId){
	var index_submit = layer.confirm('您确定要提交信息吗？', {btn: ['Yes','No'],closeBtn: 0,offset: '220px'}
	, function(){
		$("#"+formId).find("input[name='formName']").val("editForm");
		layer.close(index_submit);
		$.ajax({
		    type:"post",
		    url:common_submit_url,
		    data:$("#"+formId).serialize(),
		    dataType:"json",
		    success: function(myData){
		    	//console.log(myData);
		    	if(myData.flag=="T"){
		    		layer.alert("数据保存成功");
		    	}else{
		    		layer.alert(myData.msg);
		    	}
		    	getTemplateInfo();
		  	}
		});	
	});
}

//关闭win
function cannel(type){
	if(strUtil.isNull(type)){
		$('#my_modal_add').modal('hide');
	}else{
		$('#my_modal_'+type).modal('hide');
	}
}

function refresh(){
	getTableDataDetail();
}


function setToken(){
	$.ajax({
	    type:'get',
	    url:'/sendPage/token?token=true',
	    dataType:'text',
	    success: function(myData){
	    	console.log(myData);
			$('#addForm_formToken').val(myData);
			$('#editForm_formToken').val(myData);
	  	}
	});	
}



var objNameId = "";
var submitDetailFormId
function addTabObj(objId,formId){
	var tableAttr = "";
	objNameId = objId;
	submitDetailFormId = formId;
	//控制二次选择 或者修改时方便反显
	$("#my_modal_tablebox").modal("show");
	getTabelsDataList();
}
//查询数据
function getTabelsDataList(){
	var tableAttr = "";
	var objNameVal = $("#"+objNameId).val();
	var objNameMap = {};
	if(!strUtil.isNull(objNameVal)){
		var objNamesss = objNameVal.split(",");
		for(var a=0;a<objNamesss.length;a++){
			objNameMap[objNamesss[a]]=objNamesss[a];
		}
	}
	var objs = $("#tablebox_content");
	objs.html("");
	var index_load = layer.msg("数据正在加载中。。。", {shade: false,offset: '220px'});
	$.ajax({
	    type:'get',
	   	url:common_list_url,
	    data: $("#sortSearchForm").serialize(),
	    async:false,
	    dataType:"json",
	    success: function(myData){
	    	console.log(myData);
	    	for(var i=0;i<myData.rows.length;i++){
	    		var obj = myData.rows[i];
	    		var valStr = "";
	    		var valTitle = "";
	    		var checclass="";
	    		var csc="";
	    		if(!strUtil.isNull(obj.objName)){
	    			valStr = obj.infoTableName;
	    			valTitle = "对象名（"+obj.objName+"），描述（"+obj.sortName+"），表名（"+obj.infoTableName+"）";
		    		if(objNameMap[obj.objName]){
		    			checclass=" checked='checked' ";
		    			csc=" span-visited ";
		    		}
	    		}else{
	    			valStr = "不可用";
	    			checclass="disabled='disabled'";
	    			valTitle = "表（"+obj.infoTableName+"）未定义objName";
	    		}
	    		valStr += "-"+obj.sortName;
	    		tableAttr += "<span title='"+valTitle+"' class='col-sm-3 span-hover "+csc+"'>";
	    		tableAttr += "<input "+checclass+" name='sortInfoTableName' infoTableName='"+obj.infoTableName+"' sortCode='"+obj.sortCode+"' value='"+obj.objName+"' type='checkbox'/> "+(i+1)+"."+strUtil.subStr(valStr,20);
	    		tableAttr += "</span>";
	    	}
	    	layer.close(index_load);
	    	objs.html(tableAttr);
	  	}
	});
}
var objNameStr ,sortCodeStr;
var sortCodeMap = {};
function checkObjNameStr(){
	objNameStr = "";
	sortCodeStr = "";
	sortCodeMap = {};
	$("input[name='sortInfoTableName']:checked").each(function(){
		objNameStr +=$(this).val()+",";
		sortCodeStr +=$(this).attr("sortcode")+",";
		sortCodeMap[$(this).attr("sortcode")]=$(this).val();
	});
	objNameStr=objNameStr.substring(0,objNameStr.length-1);
	sortCodeStr=sortCodeStr.substring(0,sortCodeStr.length-1);
	if(strUtil.isNull(objNameStr)){
		layer.alert("未选中对象");
		return;
	}
	$("#"+objNameId).val(objNameStr);
	$("#my_modal_tablebox").modal("hide");
	
	//选择完成后自动保存
	$.ajax({
	    type:"post",
	    url:common_submit_url,
	    data:$("#"+submitDetailFormId).serialize(),
	    dataType:"json",
	    success: function(myData){
	    	refresh();
	  	}
	});	
}


//点击button按钮加载指定表中的字段
var objCol = "";
function addTabObjColum(ob,tabContentId,objName){
	objCol = $(ob);
	$("#all-checks").prop('checked',false);
	var index_load = layer.msg("数据正在加载中。。。", {shade: false,offset: '220px'});
	var tabTitleHtml = "",tabContentHtml="";
	var tabTobj = $("#tabs_checkbox");
	var tabTobjContent = $("#tabs_checkbox_content");
	
	var defColumVal = objCol.attr("colum");
	if(!defColumVal){
		defColumVal = $("#"+tabContentId).val();
	}
	
	$.ajax({
	    type:'get',
	   	url:common_list_url,
	    data: {"doCode":"dymicSql","modelTypes":"s_sortInfo,s_metadata","sortInfo.sortId":"[metadata.sortId]","sortInfo.w_objName":objName,"metadata.w_ifAdd":"T"},
	    async:false,
	    dataType:"json",
	    success: function(myData){
	    	console.log(myData);
	    	for(var i=0;i<myData.rows.length;i++){
	    		var obj = myData.rows[i].metadata;
	    		var valStr = objName+"."+obj.dataAttr;
	    		tabContentHtml += "<span title='"+valStr+"' class='col-sm-4 span-c'><input name='objnamecloumcheckbox' value='"+valStr+"' type='checkbox' /> <span>"+obj.dataFullName+"</span></span>";
	    	}
			tabTobjContent.html(tabContentHtml);
			layer.close(index_load);
			
			if(defColumVal){
				checkedbox("objnamecloumcheckbox", defColumVal.split(","));
			}
			$("#my_modal_colum_checkbox").modal("show");
			$("#columbox_table_name").text(objName);
	  	}
	});
}
//保存选中的字段
function checkObjColumStr(){
	var objColumStr = "";
	$("input[name='objnamecloumcheckbox']:checked").each(function(){
		objColumStr +=$(this).val()+",";
	});
	objColumStr=objColumStr.substring(0,objColumStr.length-1);
	if(strUtil.isNull(objColumStr)){
		layer.alert("未选中字段");
		return;
	}
	objCol.attr("colum",objColumStr);
	$("#my_modal_colum_checkbox").modal("hide");
}
//全选/反选
function xzcolumall(t){
	var obj = $(t);
	$("input[type='checkbox'][name='objnamecloumcheckbox']").prop('checked',obj.is(':checked'));
}
//设置复选框选中
function checkedbox(name,args) {
	if(args!=null){
		for(var i=0;i<args.length;i++) {
			$("input[type='checkbox'][name='"+name+"'][value='"+args[i]+"']").each(function(){
				$(this).prop('checked',true);
				$(this).next().attr("class","span-visited");
			});
		}
	}
}
//保存提交属性设置表单
function submitDetail(formId,title,tabContentId,btnClass){
	//alert(tabContentId+"-"+btnClass);
	var objColStr = "";
	$("."+btnClass).each(function(){
		objColStr += $(this).attr("colum")+",";
	});
	objColStr=objColStr.substring(0,objColStr.length-1);
	$("#"+tabContentId).val(objColStr);
	
	var index_submit = layer.confirm('您确定要保存['+title+']设置吗？', {btn: ['Yes','No'],closeBtn: 0,offset: '220px'}
	, function(){
		layer.close(index_submit);
		$.ajax({
		    type:"post",
		    url:common_submit_url,
		    data:$("#"+formId).serialize(),
		    dataType:"json",
		    success: function(myData){
		    	//console.log(myData);
		    	if(myData.flag=="T"){
		    		layer.alert("数据保存成功");
		    		$("#my_modal_edit").modal("hide");
		    	}else{
		    		layer.alert(myData.msg);
		    	}
		    	refresh();
		  	}
		});	
	});
}

//生成页面


 function createProject(pageId){
	
	var templateName = 	$("#pageForm").find("input[name='sysPageManager.templateName']").val();
	if(templateName ==null || templateName==""){
   	 	layer.alert("生成页面前请先选择模板！"); 
		return ;
	}
	var objNameStr = $("#input_objName_0").val();
	if((objNameStr.indexOf(",")>0) && ("T"!=$("#ifSingle-input").val())){
		alert("【是否多对象】应该设置为：T");
		$("#ifSingle-input").focus();
		$("#ifSingle-input").select();
		return;
	}
	 var index_submit = layer.confirm('您确定要开始生成吗？', {btn: ['Yes','No'],closeBtn: 0,offset: '220px'}
		, function(){
			layer.close(index_submit);
			
			var index_load = layer.msg("正在生成中。。。", {shade: false,offset: '220px'});
			  var this_url ="${ctx}/common/coding/createPage";
			  $.ajax({
				  type:'post',
				  url:this_url,
				  data:{"pageId":pageId},
				  cache: false,
				  async:false,
				  dataType:'json',
				  success: function(myData){ 
					$.ajax({
					    type:"post",
					    url:common_submit_url,
					    data:{"pageName":"sysModule-list","formName":"editForm","sysModule.w_moduleId":"${param.moduleId}","sysModule.ifUsed":"T"},
					    dataType:"json",
					    async:false,
					    success: function(myData){
					    	if(myData.flag=="T"){
						    	layer.close(index_load);
						    	 layer.alert(myData.msg); 
					    	}
					  	}
					});	
				  
				  
				  }
			  });
		})
}
//弹出选择ius参数框
var loginWin = null;
var objInputObj;
function toOpenIus(objId){
	var pageName = $("#sysPageManager_portName").val();
	var obj = $("#"+objId)
	objInputObj = obj;
	var formName = obj.val();
	cleanData('iusParamListSearchForm');//情况模态窗口内数据
	loginWin = layer.open({
	    type: 2,
	    title: '用户登录',
	    shadeClose: false,
	    shade: 0.6,
	    area: ['1100px', '600px'],
	    offset: '10px',
	    content: "${page_admin}/rule/params-list-sample?pageName="+pageName+"&formName="+formName //iframe的url
	}); 
}
//
function preIusCallBack(ob){
	layer.close(loginWin);
	var pageName = $(ob).attr("pagename");
	var formName = $(ob).attr("formname");
	var infoId = $(ob).attr("infoid");
	objInputObj.val(formName);
}
//删除tab对象
//删除二级菜单
function delTmpDetail(id,title){
	var index_submit = layer.confirm("您确定要删除【"+title+"】吗？", {btn: ['Yes','No'],closeBtn: 0,offset: '220px'}
	, function(){
		layer.close(index_submit);
		var paramData = {"pageName":"sysPageDetail-list","formName":"delForm","sysPageDetail.w_pageDetailId":id};
		$.ajax({
	    	type:"post",
	    	url:common_submit_url,
	    	data: paramData,dataType:"json",
	    	success: function(myData){
	    		var result = myData.flag;
	    		if(result=="T"){
	    			refresh();
	    		}else{
	    			layer.alert("删除失败！");
	    		}
	  		}
		});	
	});
}


function popWindow(){
	getTemplateList();
	$('#template_modal').modal('show');
}

function setSelect(templateId,templateName,templateUrl,templateDesc){
	$("#pageForm").find("input[name='sysPageManager.templateId']").val(templateId);
	$("#pageForm").find("input[name='sysPageManager.templateName']").val(templateName);
	$("#pageForm").find("input[name='sysPageManager.templateUrl']").val(templateUrl);
	$("#pageForm").find("input[name='sysPageManager.templateDesc']").val(templateDesc);
	$('#template_modal').modal('hide');

}
//读取（查询、编辑）数据
function getTemplateList(){
	deleteAllRow('templateTable');
	$.ajax({
		   type:'get',
		   url:common_list_url,
		   data:$('#templateForm').serialize()+getCurrentPage(common_list_url+"?"+$('#templateForm').serialize(),10),
		   dataType:'json',
		   success: function(myData){
			   console.log(myData);
			var data = baidu.template('templateDataList',myData);  
			$("#templateList").html(data);
			  var option= {
					   ele:$("#pageList")[0],
					   total:myData.total,
					   fn:getTemplateList,
					   url:common_list_url+"?"+$('#templateForm').serialize()
				   }
			generatePages(option);
		   }
		});	
	
}

//打开添加规则页面
function toAddSysRulesData(tempId){
	mytools.cleanData('sysRulesTemplate-searchForm');//清空模态窗口内数据
	getSysRulesData();
	$('#my_modal_rules').modal('show');
}

//加载系统级别规则列表
function getSysRulesData(){
	  //去除搜索空格
	  $("#formulaName").val($("#formulaName").val().trim());
	  $("#rulesNo").val($("#rulesNo").val().trim());
	  
		var dataListId2 = "sysRulesTemplate";
		var searchForm2 = "sysRulesTemplate-searchForm";
		deleteAllRow(dataListId2);
		$.ajax({
			   type:'get',
			   url:common_list_url,
			   data:$("#"+searchForm2).serialize()+getCurrentPage(common_list_url+"?"+$("#"+searchForm2).serialize(),10),
			   dataType:'json',
			   success: function(myData){
				var data = baidu.template(dataListId2+"-template",eval(myData));  
				$("#"+dataListId2+"-body").html(data);
				  var option= {
						   ele:$("#"+dataListId2+"-page")[0],
						   total:myData.total,
						   fn:getSysRulesData,
						   url:common_list_url+"?"+$("#"+searchForm2).serialize()
					   }
					generatePages(option);
			   }
			});	
	  }
</script>



